<%@ page language="java" import="java.util.*,entitybean.oc_boat.EntityBeanOc_Boat" pageEncoding="utf-8"%>
<%List<EntityBeanOc_Boat>list=(List<EntityBeanOc_Boat>)request.getAttribute("list");  %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>数据导入</title>
<script language="javascript">
	function ck() {
		var id= document.getElementById("id").value;
		if(id=="")
		{
			window.alert("请选择一个科考船");
			return false;
		}
		var theFile = document.getElementById("theFile").value;
		if (theFile == "") {
			window.alert("请上传文件");
			return false;
		}
		if (!chk_ext(theFile)) {
			alert("不支持此格式！");
			return false;
		}
		document.forms[0].submit();

	}
	function ltrim(s) {
		return s.replace(/^\s*/, "");
	}
	function rtrim(s) {
		return s.replace(/\s*$/, "");
	}
	function trim(s) {
		return rtrim(ltrim(s));
	}
	function get_ext(f_path) {
		var ext = '';

		if (f_path != null && trim(f_path).length > 0) {
			f_path = trim(f_path);
			ext = f_path.substring(f_path.lastIndexOf(".") + 1, f_path.length);
		}
		return ext;
	}
	function chk_ext(f_path) {
		var ext = get_ext(f_path);
		var accept_ext = new Array("XLS", "xls");
		var flag = false;

		if (ext != '') {
			for ( var i = 0; i < accept_ext.length; i++) {
				if (ext.toUpperCase() == accept_ext[i])
					flag = true;
			}
		}
		return flag;
	}
</script>


<link href="../../css/style.css" rel="stylesheet" type="text/css" />
<style>
body{
	background-color: #EAEBE3;
}
</style>
</head>
<body>


<div class="admin_nei">


<div class="xge">
  <!--<div class="xgetitle"><img src="../../images/admin_38.jpg" alt="" /></div> -->
  <div class="gt">
    
    
    
    <div class="gtt">
   <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#a0a297">
     <tr>
       <td bgcolor="#eaebe3">数据导入</td>
       </tr>
   </table>
   <form enctype="multipart/form-data" name="form1" id="form1" action="<%=request.getContextPath()%>/uploadsXlsAction.do?method=uploadsXlsAction" method="post">
   <table width="100%" border="0" cellpadding="5" cellspacing="1" bgcolor="#E6E6E6" id="admintxt">
    <tr>
    <td width="14%" align="right" bgcolor="#FFFFFF">科考船：</td>
    <td width="86%" align="left" bgcolor="#FFFFFF">
      <select name="id" id="id">
      <%for(int i=0;i<list.size();i++){ %>
      <option value="<%=list.get(i).getId()%>"><%=list.get(i).getOc_boatname()%></option>
      <%} %>
      </select>
   </td>
    
    </tr>
     <tr>
       <td width="14%" align="right" bgcolor="#FFFFFF">上传：</td>
       <td width="86%" bgcolor="#FFFFFF"><input type="file" name="theFile" id="theFile" />
         支持         
         xls格式</td>
       </tr>
     <tr>
       <td bgcolor="#FFFFFF">&nbsp;</td>
       <td bgcolor="#FFFFFF"><input type="button" name="button" id="button" value=" 提交 " onclick="ck()" /></td>
     </tr>
   </table></form>
 </div>
    
    
    
    
    </div>
  
</div>
</div>







</body>
</html>
